< previous page page_546 next page >

Page 546
e10a6a0a59f035e870d90cca05b85fce.gif
            switches = switches + 1
        Else
            ' There's no overlap. Move face 1 to
            ' the ordered_faces collection.
            ordered_faces.Add face_1
            Faces.Remove 1
            max_switches = Faces.Count
            switches = 0
        End If
    Loop ' Loop until we've ordered all the faces.

    ' Replace the Faces collection with the
    ' ordered_faces collection.
    Set Faces = ordered_faces
End Sub
The IsAbove Function
The IsAbove function checks to see if a polygon lies completely above the plane containing another polygon. Figure 15.10 shows this situation. The routine uses cross-products and dot products to decide if all the points in the first polygon lie above the plane in a manner similar to that for the backface removal test.
First, IsAbove uses the cross-product to find a normal vector for the plane. Because the function needs to decide whether the first polygon lies above the plane, it reverses
z0566-01.gif
Figure 15.10
Testing whether a face lies completely above
the plane containing another face.

 
< previous page page_546 next page >